<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'test01.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
    	request.setAttribute("name", "requestTom");
    	session.setAttribute("name", "sessionTom");
    	application.setAttribute("name", "application");
    	pageContext.setAttribute("name", "pageTom");
     %>
     EL从域中取值：<br>
     
     	request域：${requestScope.name}<br>
     	session域:${sessionScope.name}<br>
     	application域：${applicationScope.name}<br>
     	page域：${pageScope.name}<br>
     	
     	从小域到大域自动查找名为name的键值对：${name }<br>
     	从小域到大域自动查找名为name的键值对：<%=pageContext.findAttribute("name") %>
     	<hr>
     	使用EL表达式.如果取到的值为null,那么不输出:${abc }<br>
     	<%=request.getAttribute("abc") %>
     	
     	<hr>
     	
     <%
     	Cookie cookie = new Cookie("name","cookieTom");
     	response.addCookie(cookie);
      %>
     
		5>pageContext: ${pageContext.request.contextPath} <br>
		6>cookie代表浏览器发送的Cookie: ${cookie.name.value}     <br>
		//------以下不常用-------<br>               
		7>param			代表浏览器发送的参数 :${param.name}<br>
		8>paramValues	代表浏览器发送的参数 :${paramValues.name[0]} <br>
		9>header		代表浏览器请求头 :${header.Cookie}                        <br>
		10>headerValues 代表浏览器请求头 :${headerValues.Cookie[0]}                       <br>
		11>initParam	代表项目中的context-param参数 : ${initParam.name}<br>
		
		
		<hr>
		<h2>运算符</h2>
		<%
			request.setAttribute("num1", 100);
			request.setAttribute("num2", 1000);
			
		 %>
		 num1 &gt num2(">"):${num1 gt num2}<br>
		 num1 &gt;= num2(">="):${num1 ge num2}<br>
		 num1 &lt num2("<"):${num1 lt num2}<br>
		 num1 &lt;= num2("<="):${num1 le num2}<br>
		 num1 eq  num2("=="):${num1 eq num2 }<br>
		 num1 ne  num2("=="):${num1 ne num2 }<br>
		 true && true :${true and true }<br>
		 true || true :${true or true }<br>
		 !true :${not true }<br>
		 三目：${num1>num2?"num1厉害":"num2厉害" }
		 
		 <hr>
		 <%
		 	String[] arr = {"haha"};
		 	request.setAttribute("arr", arr);
		 	
		 	List list = new ArrayList();
		 	list.add("heih");
		 	request.setAttribute("list", list);
		  %>
		 empty运算符<br>
		 	字符串判断:${empty "abc" }<br>
		 			${empty "" }<br>
			对象判断：${empty null }<br>
			数组判断:${empty arr }<br>
			集合判断：${empty list }<br>	
		<hr>
		<!-- el 算术运算符  
 	 el支持 加减乘除模 运算
 	 注意: 不支持字符串加法. 如果将字符串相加,那么会自动将字符串转换为数字. 如果不能转换=>报错
 -->
		${"1"+1 }	 			
  </body>
</html>
